home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-25 | 1.8 KB | 63 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CMyCaption.cp ©1995-97 Timo Eloranta
- // ===========================================================================
- // A subclass of LCaption which uses TETextBox for drawing just like
- // LCaption did before this changed in CW7...
-
- #include "CMyCaption.h"
- #include <LStream.h>
- #include <UDrawingUtils.h>
- #include <UTextTraits.h>
-
- #ifndef __TEXTUTILS__
- #include <TextUtils.h>
- #endif
-
- // ---------------------------------------------------------------------------
- // • CreateMyCaptionStream
- // ---------------------------------------------------------------------------
- // Create a new CMyCaption object from the data in a Stream
-
- CMyCaption*
- CMyCaption::CreateMyCaptionStream(
- LStream *inStream)
- {
- return (new CMyCaption(inStream));
- }
-
- // ---------------------------------------------------------------------------
- // • CMyCaption(LStream*)
- // ---------------------------------------------------------------------------
- // Construct from data in a Stream
-
- CMyCaption::CMyCaption( LStream *inStream)
- : LCaption( inStream )
- {
- }
-
- // ---------------------------------------------------------------------------
- // • DrawSelf
- // ---------------------------------------------------------------------------
- // Draw the Caption
-
- void
- CMyCaption::DrawSelf()
- {
- Rect frame;
- CalcLocalFrameRect(frame);
-
- Int16 just = UTextTraits::SetPortTextTraits(mTxtrID);
-
- RGBColor textColor;
- ::GetForeColor(&textColor);
-
- ApplyForeAndBackColors();
- ::RGBForeColor(&textColor);
-
- // Next up is the difference between this class and LCaption.
- // I use TETextBox just like LCaption did until this changed with CW7.
-
- ::TETextBox((Ptr)&mText[1], mText[0], &frame, just);
- // UTextDrawing::DrawWithJustification((Ptr)&mText[1], mText[0], frame, just);
- }
-